<template>
	<view>
		<view class="gui-bg-white  gui-padding">
			<view class="gui-list-items" @click="productEdit(item)"  v-for="item in products">
				<view class="gui-list-image gui-relative">
					<image class="gui-list-image" mode="aspectFill"
						:src="item.product_avater">
					</image>
					<view class="gui-badge-point"></view>
				</view>
				<view class="gui-list-body gui-border-b">
					<view class="gui-list-title">
						<text class="gui-list-title-text gui-primary-text">{{item.product_name}}</text>
		
					</view>
					<text class="gui-list-body-desc gui-color-gray">{{item.product_city+item.product_address}}</text>
				</view>
				<view class="gui-text-small gui-color-gray">审核已通过</view>
				<text class="gui-list-arrow-right gui-icons gui-color-gray-light">&#xe601;</text>
			</view>
			
		
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				products:[]
			}
		},
		onLoad() {
			var self = this;
			
			uni.gRequest.get('product/list').then(result=>{
				 result.rows.forEach(x=>{
					 x.product_avater = uni.gRequest.server.replace('/app/','')+x.product_avater;
				 })
				
				self.products = result.rows;
			});
		},
		methods: {
			productEdit(x) {
				uni.navigateTo({
					url: '/pages/product/add?id=' + x.product_id
				})
			},
		}
	}
</script>

<style>

</style>
